class Solution {
public:
    bool judgeCircle(string moves) {
        int r = 0, u = 0;
        for (auto& e : moves)
        {
            if (e == 'R')
                ++r;
            else if (e == 'U')
                ++u;
            else if (e == 'L')
                --r;
            else
                --u;
        }

        return r == u && u == 0;
    }
};